﻿using System.Collections.Generic;

namespace SuperX.PermissionsService
{
    public class ResponseList<T> where T : class
    {
        /// <summary>
        /// 总数量
        /// </summary>
        public int TotalCount { get; set; }

        /// <summary>
        /// 当前页码
        /// </summary>
        public int CurrentPage { get; set; }

        /// <summary>
        /// 页面大小
        /// </summary>
        public int PageSize { get; set; }

        /// <summary>
        /// 总页码
        /// </summary>
        public int TotalPage
        {
            get
            {
                var remainder = TotalCount % PageSize;
                if(remainder == 0)
                {
                    return TotalCount / PageSize;
                }
                else
                {
                    return TotalCount / PageSize + 1;
                }
            }
        }

        public List<T> Items { get; set; }
    }
}
